package list;

/**
 * @ClassName ListNode
 * @Description TODO
 * @Author lenovo
 * @Date 2023-02-14 20:25
 * @Version 1.0
 * @Comment Magic. Do not touch.
 * If this comment is removed. the program will blow up
 */
public class ListNode {
    /**
     * 链表在内存中是不连续的，数组在内存中是连续的
     */
    public int val;
    public ListNode next;

    public ListNode() {
    }

    public ListNode(int val) {
        this.val = val;
    }

    public ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    @Override
    public String toString() {
        return "ListNode{" +
                "val=" + val +
                ", next=" + next +
                '}';
    }
}